<?php
declare(encoding='UTF-8');
header('Content-Type: text/html; charset=UTF-8');
error_reporting(-1);
if (get_magic_quotes_runtime() == 1) {
    die('Cannot run with runtime magic quotes turned on.');
}
if (get_magic_quotes_gpc() == 1) {
    die('Cannot run with magic quotes turned on.');
}
if (phpversion() < '5.2') {
    die('Cannot run with PHP version lower than 5.2');
}
define('ROOT', dirname(__FILE__));
define('WEB_DIR', substr($_SERVER['SCRIPT_NAME'], 0,
        strrpos($_SERVER['SCRIPT_NAME'], '/')));
session_start();
@ob_end_clean();
require_once dirname(__FILE__) . '/config.php';
date_default_timezone_set(Config::TIMEZONE ?
        Config::TIMEZONE : @date_default_timezone_get());
require_once dirname(__FILE__) . '/libs/Kernel.php';

try {
    ob_start();
    Kernel::init();
    ob_end_flush();
} catch (Exception $e) {
    ob_end_clean();
    require dirname(__FILE__) . '/500.html';
}
